package com.itheima.mapper;

import org.apache.ibatis.annotations.*;
import com.itheima.pojo.Dept;

import java.util.List;

/**
 * 部门管理
 */
@Mapper
public interface DeptMapper {

    /**
     * 查询所有部门
     * @return
     */
    @Select("select * from dept")
    List<Dept> list();

    @Delete("delete from dept where id = #{id}")
    Integer delete(Integer id);

    void add(Dept dept);

    @Insert("insert into dept(name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")
    void insert(Dept dept);

    @Update("update dept set name = #{name},update_time = #{updateTime} where id = #{id}")
    void edit(Dept dept);

    @Select("select * from dept where id = #{id}")
    public Dept getById(Integer id);
}
